#!/usr/bin/env python
# coding=utf-8

import redis

# 设置连接,服务器地址,端口,指定数据库,指定登录密码
r = redis.StrictRedis(host='localhost', port=6379, db=0, password='asdzxc123')

# 写入值
r.set('key', '卧底007')

# 读取值,注意读取必须转码,加decode()
st = r.get('key').decode()
print(st)
